﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using WebSysCore.JSons;
using WebSysCore;
using WebSysCore.Helpers;
using HSchSchedule.Utils;


namespace HSchSchedule.AjaxPages
{
    public partial class AjaxViewSchedule : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        [WebMethod(true)]
        public static string GetListSchedule()
        {
            int cusId;
            int.TryParse(HttpContext.Current.Session[GUIConstants.CUSTOMERID_SESSION].ToString(), out cusId);
                        
            List<ListSchedule> lstAll;
            List<JListSchedule> lstAllJ = new List<JListSchedule>();

            lstAll = DataBase.GetAllSchedule(cusId);
            foreach (ListSchedule l in lstAll)
            {
                JListSchedule j = AssignHelp.ListScheduleToJListSchedule(l);
                lstAllJ.Add(j);
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Serialize(lstAllJ);
        }
    }
}
